﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Swd05.SH.Bll;
using Swd05.SH.Interfaces;

namespace SH.RealWorld
{
	public partial class RealWorldExplorer : Form
	{
		private IScriptEngine engine = null;
		public RealWorldExplorer()
		{
			InitializeComponent();
			this.Load += new EventHandler( this.RealWorldExplorer_Load );
		}
		#region Methods
		void RealWorldExplorer_Load(object sender, EventArgs e)
		{
			this.engine = Facade.Instance.Create( this );
		}

		private void pb_save_Click(object sender, EventArgs e)
		{
			bool result = false;
			
			result = (bool)this.Engine.Eval( "Validate" );
			
			if( ! result )
			{
				MessageBox.Show( this, "Validation unsuccessful!", "Sorry" );
			}
		}
		#endregion
		#region Properties
		[ExternalInterface( "Text" )]
		public string Input
		{
			get
			{
				return this.tbInput.Text;
			}
		}
		private IScriptEngine Engine
		{
			get
			{
				return this.engine;
			}
		}
		#endregion
	}
}
